<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title>Paste Bin</title>
        <link rel="stylesheet" type="text/css" media="screen" href="/style.css" />
        <style type="text/css">
            /* make it clear */
            .paste-body {width:100%;overflow:hidden;}
        </style>
    </head>
    <body>
        <div id="main">
            <table id="title-bar">
                <tr>
                    <td>
                        <h1>
                            <a href="/" class="text-like">Paste</a> <a href="/limit/1000/page/0" class="text-like">Bin</a>
                        </h1>
                    </td>
                    <td align="right">
                        {% if user %}
                        {{ user.nickname }}<a href="{{ url }}" class="url">logout</a>
                        {% else %}
                        <a href="{{ url }}" class="url">login</a>
                        {% endif %}
                    </td>
                </tr>
            </table>
            <div id="post-new">
                <form action="/add" method="post">
                    <table width="100%">
                        <tbody>
                            <tr>
                                <td><textarea id="txt" name="txt" wrap="off"></textarea></td>
                                <td width="100px" style=""><input type="submit" onclick="" value="OK" class="btn"/></td>
                            </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <ul class="post-list">
	{% for post in posts %}
                <li id="post_{{ post.key.id }}" class="paste-item">
                    <pre id="pre_{{ post.key.id }}" class="paste-body">{{ post.body|escape|urlize }}</pre>
                    <cite class="paste-foot">
                        <a href="/{{ post.key.id }}.txt" target="_blank">txt</a>
                        <a href="/{{ post.key.id }}.html" target="_blank">html</a> from {{ post.author.nickname|default:"anonymous" }} on {{ post.created|date:"Y-m-d" }} {{ post.created|time:"H:i:s" }} ({{ post.created|timesince }})
                        <a onclick="return toggleView('{{ post.key.id }}',this);" href="#post_{{ post.key.id }}">w</a>
		{% if user %}
                        <a href="/edit/{{ post.key.id }}">e</a>
                        <a onclick="return confirm('delete #{{ post.key.id }}?');" href="/del/{{ post.key.id }}">d</a>
		{% endif %}
                    </cite>
                </li>
	{% endfor %}
            </ul>
            <div id="paginator">
                <ul>
                    <li>
                        {% ifequal pager.page_prev pager.page_cur %}
                        <a href="JavaScript:void(0);" class="cur_page">&lt;</a>
                        {% else %}
                        <a href="/limit/{{pager.page_limit}}/page/{{pager.page_prev}}">&lt;</a>
                        {% endifequal %}
                    </li>
                    <li>
                        {% ifequal pager.page_next pager.page_cur %}
                        <a href="JavaScript:void(0);" class="cur_page">&gt;</a>
                        {% else %}
                        <a href="/limit/{{pager.page_limit}}/page/{{pager.page_next}}">&gt;</a>
                        {% endifequal %}
                    </li>
                    {% for p in pager.page_list %}
                    <li>
                        {% ifequal p pager.page_cur %}
                        <a href="JavaScript:void(0);" class="cur_page">{{p}}</a>
                        {% else %}
                        <a href="/limit/{{pager.page_limit}}/page/{{p}}">{{p}}</a>
                        {% endifequal %}
                    </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
        <script type="text/javascript" src="/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="/main.js"></script>
    </body>

</html>
